<?php
	class lopdata
	{
		public function Them($lop_ma = "", $lop_ten = "", $lop_manganh="")
		{
			$sql = "INSERT INTO lop(lop_ma, lop_ten, lop_manganh)
					VALUES('$lop_ma', '$lop_ten','lop_manganh')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($lop_ma = "", $lop_ten = "", $lop_manganh="")
		{
			$sql = "UPDATE `lop` SET `lop_ten` = '$lop_ten', `lop_manganh` WHERE lop_ma = '$lop_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($lop_ma = "")
		{
			$sql = "DELETE  FROM lop WHERE lop_ma = '$lop_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($lop_ma = "")
		{
			$sql = "SELECT * FROM lop WHERE 1";
			
			if($lop_ma != "")
				$sql .= " AND lop_ma = '$lop_ma'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>